//
// Created by xili on 2024/9/13 14:40.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int maximumProduct(vector<int> &nums, int k) {
        //小根堆
        priority_queue<int, vector<int>, greater<int>> pq(nums.begin(), nums.end());
        while (k--) {
            pq.push(pq.top() + 1);
            pq.pop();
        }
        long long ans = 1;
        int mod = 1000000007;
        while (!pq.empty()) {
            ans = (ans * pq.top()) % mod;
            pq.pop();
        }
        return ans;
    }
};